<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/data_edit.php");                     // 当前页面的控制器 ?>



<body>

<!--顶部栏-->
<div id="topbar"> <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?></div>

<!--容器-->
<div id="container" class="<? echo $now_extender ?>">

    <!--侧边栏-->
    <div id="sidebar"><?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?></div>





    <?
    //==============================================================================
    //这里开始才是平常开发需要注重的部分，其余的基本不用理会
    //==============================================================================
    ?>

    <div id="content" class="layui-form">




			<?php $page_title='部门编辑';?>
<fieldset class="layui-elem-field layui-field-title">
                <legend> <?php echo $page_title;?> </legend>
            </fieldset>


            <div class="list-box">
     			<div class="box department-add-box detail-box">

       <form id="edit-department-form" method="post" action="detail-edit-function.php?nav-itemed=department" enctype="multipart/form-data" >



                        <div class="layui-form-item">
                            <label class="layui-form-label">部门名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" required  lay-verify="required" placeholder="请输入部门名称" value="<?echo $detail['name']?>" autocomplete="off" class="layui-input">
                            </div>
                        </div>


						<div class="layui-form-item">
							<label class="layui-form-label">所属部门</label>
							<div class="layui-input-block">
                                <select name="parent_id" lay-verify="required">
                                    <option value="<?echo $parent['nid']?>"><?echo $parent['name']?></option>
                                    <?foreach ($school_list as $val)
                                    {
                                        echo '<option value="'.$val['nid'].'">'.$val['name'].'</option>';

                                        foreach ($val[$val['name']] as $val2)
                                        {
                                            echo '<option value="'.$val2['nid'].'"> &nbsp; '.$val2['name'].'</option>';
                                            foreach ($val2[$val2['name']] as $val3)
                                            {
                                                echo '<option value="'.$val3['nid'].'"> &nbsp; &nbsp; '.$val3['name'].'</option>';
                                            }

                                        }
                                    }?>

                                </select>
							</div>
						</div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">位置</label>
                            <div class="layui-input-block">
                                <input type="text" name="location" placeholder="请输入部门位置"  value="<?echo $detail['location']?>" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="phone" placeholder="请输入部门电话" value="<?echo $detail['phone']?>" autocomplete="off" class="layui-input">
                            </div>
                        </div>



                        <div class="layui-form-item">
                            <label class="layui-form-label">建立日期</label>
                            <div class="layui-input-block">

                                <input type="text" name="builddate" id="date" autocomplete="off"
                                       placeholder="请输入建立日期" class="layui-input laydate laydate-icon"
                                       value="<? echo $detail['builddate']?>"
                                        />
                            </div>
                        </div>




                        <?
                        $principal_list=select_lines_all_items($table_Prefix."employee","nid desc","","0");
                        $principal=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['principal']."'");
                        ?>

                        <div class="layui-form-item">
                            <label class="layui-form-label">负责人</label>
                            <div class="layui-input-block">
                                <select name="principal" lay-search="">


                                    <option  value="无" > 无</option>

                                    <? for($i=0;$i<count($principal_list);$i++){ ?>
                                        <option <?echo $detail['principal'] == $principal_list[$i]['nid'] ?'selected':'' ?> value="<? echo $principal_list[$i]['nid'] ?>"><? echo $principal_list[$i]['mid'] ?> : <? echo $principal_list[$i]['name'] ?></option>
                                    <? } ?>
                                </select>
                            </div>
                        </div>







           <div class="layui-form-item" style="display: none">

           <label class="layui-form-label">当前状态</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="启用" title="启用" <? if($detail['status']=="启用"){echo "checked";} ?>>
                                <input type="radio" name="status" value="关闭" title="关闭" <? if($detail['status']=="关闭"){echo "checked";} ?>>
                            </div>
                        </div>



                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="remark" placeholder="备注" class="layui-textarea"><?echo $detail['reamrk']?></textarea>
                            </div>
                        </div>



                            <input type="hidden" name="nid" value="<?echo $detail['nid']?>"  >






                        <div class="function">
                                <button class="layui-btn" lay-submit lay-filter="formMemberAdd" type="submit">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            <a href="detail-list.php?now_extender=<? echo $_REQUEST['now_extender'] ?>" class="layui-btn layui-btn-primary">返回列表</a>

                        </div>
                        </div>
                    </form>

                    <script>
                        //Demo
                        //Demo
                        layui.use('form', function(){
                            var form = layui.form;



                            //监听提交
                            // form.on('submit(formMemberAdd)', function(data){
                            // layer.msg(JSON.stringify(data.field));
                            // layer.msg("这只是返回消息而已");
                            // return false;
                            // });




                        });
                    </script>



            </div>


        </div>
    		</div>

	</div>

</div>
<!--底部栏-->
<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>
</body>
</html>